package sy.service.impl;

import java.io.Serializable;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.apache.log4j.Logger;

import sy.dao.SysUnitDaoI;
import sy.model.SysBuilding;
import sy.model.SysUnit;
import sy.service.SysUnitServiceI;

@Service("sysUnitService")
public class SysUnitServiceImpl implements SysUnitServiceI {
	
	private static final Logger logger = Logger.getLogger(SysUnit.class);
	private SysUnitDaoI sysUnitDao;


	public SysUnitDaoI getSysUnitDao() {
		return sysUnitDao;
	}

	@Autowired
	public void setSysUnitDao(SysUnitDaoI sysUnitDao) {
		this.sysUnitDao = sysUnitDao;
	}

	@Override
	public Serializable save(SysUnit sysUnit) {
		
		return sysUnitDao.save(sysUnit);
	}

	@Override
	public void remove(String[] ids) {
		// TODO Auto-generated method stub
		for (int i = 0; i < ids.length; i++) {
			SysUnit sysUnit =	sysUnitDao.getSysUnitById(ids[i]);
			sysUnitDao.remove(sysUnit);
		}
	}

	/* (non-Javadoc)
	 * @see sy.service.SysUnitServiceI#update(sy.model.SysUnit)
	 */
	@Override
	public void update(SysUnit sysUnit) {
		// TODO Auto-generated method stub
		sysUnitDao.update(sysUnit);
	}

	/* (non-Javadoc)
	 * @see sy.service.SysUnitServiceI#list()
	 */
	@Override
	public List<SysUnit> list() {
		// TODO Auto-generated method stub
		return sysUnitDao.list();
	}

	/* (non-Javadoc)
	 * @see sy.service.SysUnitServiceI#getSysUnitById(java.lang.String)
	 */
	@Override
	public SysUnit getSysUnitById(String id) {
		// TODO Auto-generated method stub
		return sysUnitDao.getSysUnitById(id);
	}

	/* (non-Javadoc)
	 * @see sy.service.SysUnitServiceI#listSysUnitByKey(java.lang.String)
	 */
	@Override
	public List<SysUnit> listSysUnitByKey(String key) {
		// TODO Auto-generated method stub
		return sysUnitDao.listSysUnitByKey(key);
	}



}
